package com.os.ordersystem.controller;

import com.os.ordersystem.bean.ResultDTO;
import com.os.ordersystem.bean.Type;
import com.os.ordersystem.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/type")
public class TypeController {

    @Autowired
    private TypeService typeService;

    //获取所有类型
    @GetMapping("getAll")
    public ResultDTO getAll() {

        List<Type> list =  typeService.getAll();

        return new ResultDTO(200, "获取成功！", list);
    }

}
